# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=nzyme
pkgver=1.2.2
pkgrel=1
pkgdesc='WiFi defense system.'
arch=('any')
groups=('blackarch' 'blackarch-wireless' 'blackarch-defensive')
url='https://www.nzyme.org/download'
license=('custom:SSPL')
depends=('java-environment')
source=("https://assets.nzyme.org/releases/$pkgname-$pkgver.jar"
        "https://raw.githubusercontent.com/lennartkoopmann/$pkgname/master/$pkgname.conf.example"
        "https://raw.githubusercontent.com/lennartkoopmann/$pkgname/master/$pkgname-tracker.conf.example")
noextract=("$pkgname-$pkgver.jar")
sha512sums=('cd96ec2a5140b69417a03bac4264059764289d150a096f9b03d809b6b0d3acdc3f9689bb4f3fcc953f925eb0ad7d561f7738a2cd2e344e3d5b3420757a746a30'
            'a9bd90faf653e8edddf03e6b9f8769fa250da0f5f2ccbd244af2164e00321aad563c54ae733052aff59366dcf450373d20bd8b68119fbc0ce6ac5f49916d1672'
            '11105ec9dc6bb0b0a1eca6682d1cebd8bfd17add7ba8eece3261d0c446d81eaaa89e68e7ea5e5f4bb77a80036796366e818ba373bd1270c0a3efd39b4760387f')

package() {
  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 644 "$pkgname-$pkgver.jar" \
    "$pkgdir/usr/share/$pkgname/$pkgname-$pkgver.jar"

  install -m 644 -t "$pkgdir/usr/share/$pkgname/" *.example

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec java -jar /usr/share/$pkgname/$pkgname-$pkgver.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

